<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="js/vue.js"></script>
</head>

<body>
    <!-- 挂载的父元素 -->
    <div id="app">
        <input type="text" v-model.number.lazy="num1">
        <select v-model="ope">
            <option value="+">+</option>
            <option value="-">-</option>
            <option value="*">*</option>
            <option value="/">/</option>
        </select>
        <input type="text" v-model.number.lazy="num2">
        <button @click="relBtn">=</button>
        <input type="text" v-model="rel">
    </div>
    <script>
        var app = new Vue({
            el: '#app',
            data: {
                num1: '',
                num2: '',
                ope: '+',
                rel: ''
            },
            methods: {
                relBtn() {
                    console.log(this.ope);
                    switch (this.ope) {
                        case '+':
                            this.rel = this.num1 + this.num2;
                            break;
                        case '-':
                            this.rel = this.num1 - this.num2;
                            break;
                        case '*':
                            this.rel = this.num1 * this.num2;
                            break;
                        case '/':
                            this.rel = this.num1 / this.num2;
                            break;
                        default:
                            this.rel = ''
                    }
                }

            }
        });
    </script>
</body>

</html>